# 替换源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo cp ./sources.list /etc/apt/sources.list
sudo apt-get update

# 当中碰到问题：cd /etc/apt/sources.lis.d 
# 然后删除对应的list文件：rm ubuntu-toolchain-r-ubuntu-test-bionic.list

# 安装gcc
 # ==================================
 # pan: failed
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install build-essential
sudo apt-get install gcc-9 g++-9
sudo ln -snf /usr/bin/gcc-9 /usr/bin/gcc
sudo ln -snf /usr/bin/g++-9 /usr/bin/g++
 # ==================================


 # ==================================
 # pan: take below method
 # 1:
 # add /etc/apt/apt.conf.d/95proxy.conf
 # Aquire::http::Proxy "false";
 # Aquire::https::Proxy "false";
 # 2:
 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak0
 sudo cp ./sources_ppa.list /etc/apt/sources.list
 # 3: 从这里取得ppa证书，注意选择版本为1804（这里是：60C317803A41BA51845E371A1E9377A2BA9EF27F）。 https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test?field.series_filter=trusty
 # 4: ubuntu上操作添加证书（ID用：60C317803A41BA51845E371A1E9377A2BA9EF27F）：sudo apt-key adv --keyserver keyserver.ubuntu.com --recv ID
 # 5: 执行：sudo apt-get update && sudo apt-get upgrade
 # 6: 执行：sudo apt install gcc-9 g++-9
